<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><!--//$Id$  -->
  <title>CIAO application</title></head>


<body alink="#0000ff" bgcolor="#ffffff" link="#000fff" text="#000000" vlink="#ff0f0f">

<h2>Display example README</h2>
<li>To download the code of this example please refer to the CVS repository at <code>$CIAO_ROOT/DAnCE/examples/Display</code>.</li>
<hr>

<h2>Example Description</h2>

<font face="Times New Roman" size="4">This example is an imaginary car
(software) instrument assembly which updates the display of
current coordination of the airplane periodically.  It consists of
the following three components:
<ul>
  <li>The <font face="Courier New">RateGen</font> component sends periodic
  <font face="Courier New">Pulse</font> events to consumers according to the
  rate specified in its attribute <font face="Courier New">Rate</font>, it
  allows a client (CORBA client <font face="Courier New">controller</font>) to
  start and stop the rate generating event.</li>
  <li>The <font face="Courier New">GPS</font> component interacts with a GPS
  hardware. When the <font face="Courier New">GPS</font> component receives
  <font face="Courier New">Refresh</font> events from <font face="Courier New">
  RateGen</font>, it queries the GPS hardware and updates the internal cached
  coordination (so that the current location can be read by accessing the
  <font face="Courier New">MyLocation</font> interface) and generates an event
  on its <font face="Courier New">Ready</font> port to inform the event
  consumers that a new GPS reading is available. </li>
  <li>The <font face="Courier New">NavDisplay</font> component displays the
  current location of the vehicle on the windshield. When a
  <font face="Courier New">NavDisplay</font> receives an event notifying the
  availability of new data on its <font face="Courier New">Refresh</font> port,
  it will acquire the current location of the vehicle by querying the interface
  connected to the <font face="Courier New">GPSLocation</font> receptacle.</li>
  <li>The <font face="Courier New">NavDisplayGUI</font> directory contains
  implementations for a <font face="Courier New">NavDisplay</font> with
  graphical interface. To use this graphical interface you need to install qt
  libraries and have qt enabled (qt = 1) in your <font face="Courier New">$ACE_ROOT/bin/MakeProjectCreator/config/global.features</font>.
  In some Linux distributions qt is installed by default. There is a
  non-commercial version of qt libraries for Windows
  <a href="http://www.dre.vanderbilt.edu/%7Edengg/ITS/qt-win-noncommercial-msvc-3.2.1.exe">
  here</a> and more information about qt
  <a href="http://www.trolltech.com/products/qt/index.html">here</a>. </li>
  <li>If you just want to run the application, just go to the last section of
  this page.</li>
</ul>
<hr>

<h2>The files you will find.</h2>


<li>1. The interfaces,
data types and exceptions used by the components of this application are 
specified in the
<a href="HUDisplay.idl"> <code>
HUDisplay.idl</code></a> file, placed in this example root directory ($CIAO_ROOT/examples/Display).
This is a IDL2 file and uses the familiar CORBA data types. The lib generated
from HUDisplay.idl is linked to all the components of this example. <p></p>

</li><li>2. mpc  files for each of the components
are available in the components directories. We use the  <a href="http://downloads.ociweb.com/MPC/MakeProjectCreator.pdf">MPC</a>
to generate makefiles and Visual C++ project/solutions files for all <a href="http://www.cs.wustl.edu/%7Eschmidt/ACE.html">ACE</a>, <a href="http://www.cs.wustl.edu/%7Eschmidt/TAO.html">TAO</a> and <a href="http://www.cs.wustl.edu/%7Eschmidt/CIAO.html">CIAO</a> libraries.

</li><li>3. idl and cidl files for each component are placed in components directory.  </li>

<li>4. The <code>_exec.h</code> and <code>_exec.cpp</code> files are the actual implementation of the components.</li>

<li>5. The <code>NavDisplayGUI_exec</code> directory:
<font face="Times New Roman">The <code>NavDisplayGUI_exec.cpp</code> is just an executor version
for NavDisplay. In NavDisplayGUI_exec directory you'll find only the the
NavDisplayGUI_exec (and files for the GUI), which can be deployed with the
NavDisplay stub and servant. So, if you deploy the NavDisplay component
using NavDisplay_exec you'll be able to see the application running in the shell
you triggered the NodeDaemon, and if you deploy the NavDisplay component using
<code>NavDisplayGUI_exec</code> a graphical interface will show you a red dot moving over a
map according to the location being generated by GPS component when you start
the application. Notice that the <code>NavDisplayGUI.mpc</code> file includes <em>qt</em>, used for
graphical interface. You must give the right location of qt libraries in your mpc file.</font>
</li>

<li>6. The <code>controller</code>:
<font face="Times New Roman">The <code>RateGen</code>component is started and stopped by the <code>controller</code>, a CORBA client application.
The <code>controller</code> source is in <code>RateGen</code> directory, so the <code>RateGen.mpc</code> file also
include instructions for the <code>controller</code>
build.</font>

</li>



<hr>

<h3><font size="5">Make</font></h3>
<li>Go to the directory <code>$CIAO_ROOT/DAnCE/examples/Display</code> and do:<br>
    <code>$ACE_ROOT/bin/mwc.pl</code> (use -type option if you are using a compiler/IDE other than gnuace -which by default generates GNU makefiles)</li>
    <br>For example, using <code>$ACE_ROOT/bin/mwc.pl -type vc71</code> if you are using Visual C++ 7.1 IDE.


<hr>

<h3><font size="5">Assemble</font></h3>
Now we can step forward to build the assembly.

<li> In the descriptor subdirectory, you'll find a XML descriptor file that describes your <em>deployment plan</em>, the flattened_deploymentplan.cdp:
  <dd>
This file declaratively specifies how the component assembly is
constructed. Specifically, it specifies the component types, component
instances, component connections and implementation artifact
descriptions. </dd>
<br>
</li><li> Please make sure that the Modified_Deployment.xsd and XMI.xsd files are in the
Display/descriptors directory.
The former file could be found in $CIAO_ROOT/docs/schema directory.
<br>


<br>
Note: Creating the deployment plan descriptor is a tedious and error-prone job, you can download <a href="http://www.dre.vanderbilt.edu/cosmic"> CoSMIC</a> to assist you in this step.
</li>

<p>&nbsp;</p>

<hr align="justify">
<h3><font size="5">Run</font></h3>
Finally you are ready to test the application you have made. From different shells in <code>$CIAO_ROOT/DAnCE/examples/Display/descriptors/</code> directory:
<br><br>

<ul>
  <li> Start NodeManagers (NodeDameon) by running <code> basicNodeDaemons.pl </code>

  </li><li> Start the execution manager:
  <code>$CIAO_ROOT/DAnCE/ExecutionManager/Execution_Manager -o EM.ior -i NodeManagerMap.dat </code>
  The NodeManagerMap.dat file describes the deployment daemons CIAO's Execution_Manager
  will contact to instantiate ComponentServer's, home's, and component
  instances.  Each line specify the name of a installation
  "destination" and the corresponding IOR for
  the CIAO_Daemon. For example, the NodeManagerMap.dat contains:

      AirFrameDevice corbaloc:iiop:localhost:10000/NodeManager
      TimerDevice  corbaloc:iiop:localhost:12000/NodeManager

  You can copy and modify the copy to deploy the components in various
  different locations to let the application truely "distributed".

  Remember to start up the Execution_Manager  using the
  revised .dat file you created, and start up the CIAO_Daemon according to the specification.

  </li>

  <ul type="square"> <li> <em>NOTE</em>: As one can see, we use the "NodeManagerMap.dat" file to instruct the
       Execution_Manager how to find the endpoint of each individual NodeManager (i.e., Node Daemon) where
       component(s) will be deployed, so this is non-standard. We plan to use Naming Service to do this in the future.
  </li></ul>

  <li> Start the plan_launcher:
  <code> $CIAO_ROOT/DAnCE/Plan_Launcher/plan_launcher -p flattened_deploymentplan.cdp -k file://EM.ior </code>

  After this, components should be deployed successfully.

  </li><li> The Assembly_Manager is instructed to write the IOR of the RateGen
  component to a file called "rategen.ior" in this
  directory.  You will then need to use a controller program in a
  separate shell window to switch on/off the Rate Generator.
  Go to the <em> $CIAO_ROOT/DAnCE/examples/Display/descriptor </em> directory and run the <code>$CIAO_ROOT/DAnCE/examples/Display/RateGen/controller
  -o </code> to start the application. To stop the application run <code>$CIAO_ROOT/DAnCE/examples/Display/RateGen/controller
  -f </code>
  </li>
</ul>



<hr>
<b>Email: </b><a href="mailto:"></a><address>ciao-users@cse.wustl.edu</address>
</body></html>
